From af5ecd77e3f0d7f093a4a311bbf628980875ef36 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Granjoux?= Date: Sat, 26 May 2012 22:32:07 +0200 Subject: [PATCH] button: Clear highlight when a button is removed from a container A button is highlighted if the private variable in_button is TRUE. This variable is set when the pointer is over the button and cleared when it left the button. When a button is hidden while there is the pointer over it, GTK generates a leave notification event, in_button is set to FALSE. But when a button is removed from a container but not destroyed, it is unrealized and loose its window. It cannot receive the leave notification event and in_button stay TRUE. So when the button get a new parent it is still highlighted. https://bugzilla.gnome.org/show_bug.cgi?id=676890 --- gtk/gtkbutton.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 621cd4f4ac..824f4986e9 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -1461,7 +1461,10 @@ gtk_button_unmap (GtkWidget *widget) GtkButtonPrivate *priv = button->priv; if (priv->event_window) - gdk_window_hide (priv->event_window); + { + gdk_window_hide (priv->event_window); + priv->in_button = FALSE; + } GTK_WIDGET_CLASS (gtk_button_parent_class)->unmap (widget); } -- 2.30.2